﻿#include "OperatorCreateAcceleration.h"
#include "GUIDialog/GUIAnalysisDialog/GUIAccelDialog.h"
#include "FITK_Component/FITKRadiossData/FITKRadiossCase.h"
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"

#include "OperatorsInterface/GraphEventOperator.h"
#include "OperatorsInterface/TreeEventOperator.h"

bool ModelOper::OperatorCreateAcceleration::execGUI()
{
    if (_emitter == nullptr)return false;
    QString name = _emitter->objectName();
    if (name.isEmpty())return false;
    // 获取主窗口
    QWidget* mainwindow = FITKAPP->getGlobalData()->getMainWindow();
    if (mainwindow == nullptr) return false;

    if (name == "actionCreateAcceleration")
    {
        GUI::GUIAccelDialog* dlg = new GUI::GUIAccelDialog(nullptr,mainwindow);
        connect(dlg, &QDialog::accepted, this, &OperatorCreateAcceleration::execProfession);
        dlg->show();
    }
    else if (name == "actionEditAcceleration")
    {
      //  GUI::GUIAccelDialog* dlg = new GUI::GUIAccelDialog( 加速度计对象,mainwindow);


    }

    return true;
}

bool ModelOper::OperatorCreateAcceleration::execProfession()
{
    EventOper::TreeEventOperator* oper = dynamic_cast<EventOper::TreeEventOperator*>(FITKOPERREPO->getOperator("TreeSolutionEvent"));
    if (oper != nullptr) oper->updateTree();
    return false;
}
